package com.hmall.order.controller;


import com.hmall.common.dto.ResultDTO;
import com.hmall.order.pojo.Order;
import com.hmall.order.service.ToPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("")
@RestController
public class OrderToPayController {

    @Autowired
    private ToPayService toPayService;

    @PutMapping("/pay/{orderId}")
    public ResultDTO toPay(@PathVariable("orderId") Long orderId,
                           @RequestBody String password){
       return toPayService.pay(orderId,password);
    }


    @GetMapping("/order/{id}")
    public Order querOrderById(@PathVariable("id") Long id){
       return toPayService.getById(id);
    }
}
